﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using medicine.General;

namespace medicine.BaseComponents.Groups
{
    public enum eColumnsTypes
    {
        Periods,
        Measures
    }

    public partial class SelectedColumns : UserControl
    {
        public string LabelText
        {
            get { return label1.Text; }
            set { label1.Text = value; }
        }
        public eColumnsTypes ColumnType
        { get; set; }

        public SelectedColumns()
        {
            InitializeComponent();


        }
        private void SelectedColumns_Load(object sender, EventArgs e)
        {
            GroupInfo _GI = new GroupInfo();
            //-------------------------------------
            _GI.DBDisplayField = "Name";
            _GI.DBValueField = "Value";
            _GI.isColumn = true;
            //-------------------------------------
            if (this.ColumnType == eColumnsTypes.Periods)
            {
                _GI.CustomDataSource = new PeriodsCustomDataSource();
                _GI.DBTableName = "Periods";
            }
            else
            {
                _GI.CustomDataSource = new UnitsCustomDataSource();
                _GI.DBTableName = "Measures";
            }
            this.label1.GroupInfo = _GI;
            MedicinUtilities.AddColumnLabels(this.label1);
        }
        private void btnRedefine_Click(object sender, EventArgs e)
        {
 
        }

        private void label1_Click(object sender, EventArgs e)
        {
            //GroupLabel _GL = new GroupLabel();
            //-------------------------------------
            ItemSelectionFRM frm = new ItemSelectionFRM();
            if (DialogResult.OK == frm.ShowDialog(this, this.label1))
            {
                this.label1.SetColor();
                this.label1.FireAfterRowSelection();
            }
            //-------------------------------------
        }

        public void Reset()
        {
            this.label1.Reset();
        }

    }
}
